import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int q = in.nextInt();
        while(q > 0) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            int min = Math.min(Math.min(a, b), c);
            int score = 0;
            score = 2 * min;
            a -= min;
            b -= min;
            c -= min;
            if(b > 0) {
                score += b - 1;
            }
            System.out.println(score);
            q--;
        }
    }
}